home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr28 / mxmnu239.zip / WINSUP.INC < prev    next >
Text File  |  1993-03-22  |  3KB  |  133 lines

  1. Comment
  2. ==========================================================
  3.  
  4. Menu support routines.
  5.  
  6. ==========================================================
  7. EndComment
  8.  
  9.  
  10. ;----- Support routines for conditional menus
  11.  
  12. Var
  13.   VertLine = "┬││││││││││││││││││││││││││││││││││││││││││││││││││││││││││││"
  14.   VertLine2 = "││││││││││││││││││││││││││││││││││││││││││││││││││││││││││││"
  15.   VertLine3 = "┌─┴┴┴┴─┐"
  16.   VertLine4 = "└─┬┬┬┬─┘"
  17.   IndexString
  18.   MyGroups
  19.  
  20. ;----- Adds a choice to list
  21.  
  22. Procedure AddChoice (Prompt,TaskNum)
  23.    if TaskNum <> 0
  24.       IndexString[CurrentWindow + 1] = Left(IndexString[CurrentWindow + 1],NumberOfElements(Choices)) + Char(TaskNum + 64)
  25.    endif
  26.    AppendArray(Choices,Prompt)
  27. EndProc
  28.  
  29. ;----- Compares TaskNum to Choice
  30.  
  31. Procedure Task (TaskNum)
  32.    if Mid(IndexString[CurrentWindow],Ord(LastKey) - 64,1) = Char(TaskNum + 64)
  33.       Return LastKey
  34.    else
  35.       Return ""
  36.    endif
  37. EndProc
  38.  
  39. ;----- Code for Group Conditionals
  40.  
  41. if NovConnection > 0
  42.    NovReadGroups(NovLoginName,MyGroups)    ;Read Groups user is in.
  43.    SortArray(MyGroups)
  44. endif
  45.  
  46. ;----- Returns True if in list
  47.  
  48. Procedure InGroup (Group)
  49.    Return PosInSortedList(UpperCase(Group),MyGroups) > 0
  50. EndProc
  51.  
  52. ;----- Wondowing Support
  53.  
  54. Procedure CenterStretchBox (Header,Col,Row)
  55.    MakeBox(Header,Col,Row,True)
  56. EndProc
  57.  
  58.  
  59. Procedure CornerStretchBox (Header,Col,Row)
  60.    if Row = 0 then Row = 5
  61.    if Col = 0 then Col = 8 + (CurrentWindow - 3 * 4)
  62.    MakeBox(Header,Col,Row,False)
  63. EndProc
  64.  
  65.  
  66. ;------ MenuExit Procedure
  67.  
  68. Procedure LeaveMenu
  69.    DrawTheBox (ScreenWidth / 2 - 4,ScreenHeight / 2 - 1,13,HeightDifference + 2,'Exit Menu')
  70.    Writeln " Yes"
  71.    Write   " No"
  72.  
  73.    OnKey "Y"
  74.       |ExitMenu
  75.  
  76.    OnKey "N"
  77.       |LastKey = Esc
  78.  
  79. EndProc
  80.  
  81. ;------ Read a Text Line Procedure
  82.  
  83. Procedure ReadTextLine(St,Header,Col,Row)
  84. var AnswerLine
  85.    Choices[1] = ""
  86.    CenterStretchBox(Header,Col,Row)
  87.    Write " " St " "
  88.    TextColor(MenuCapColorFG,MenuBG)
  89.    AnswerLine = Readln
  90.    EraseTopWindow
  91.    Dispose Choices
  92.    Return AnswerLine
  93. EndProc
  94.  
  95. ;----- View a File
  96.  
  97. Procedure ViewFile (Name)
  98.    if Name = '' then Return
  99.    BoxHeader = ' Viewing ' + Name + ' '
  100.    Shadow Off
  101.    DrawBox 1 4 80 21
  102.    TextColor MenuHeaderFG MenuBG
  103.    ViewTextFile Name
  104. EndProc
  105.  
  106. Procedure GreekColumns
  107.    TextColor GreekFG GreekBG
  108.    GotoXY 4,4
  109.    WriteVertical VertLine2
  110.    GotoXY 5,4
  111.    WriteVertical VertLine2
  112.    GotoXY 6,4
  113.    WriteVertical VertLine2
  114.    GotoXY 7,4
  115.    WriteVertical VertLine2
  116.    GotoXY ScreenWidth - 6,4
  117.    WriteVertical VertLine2
  118.    GotoXY ScreenWidth - 5,4
  119.    WriteVertical VertLine2
  120.    GotoXY ScreenWidth - 4,4
  121.    WriteVertical VertLine2
  122.    GotoXY ScreenWidth - 3,4
  123.    WriteVertical VertLine2
  124.    GotoXY 2,4
  125.    Write VertLine4
  126.    GotoXY ScreenWidth - 8,4
  127.    Write VertLine4
  128.    GotoXY 2,ScreenHeight - 1
  129.    Write VertLine3
  130.    GotoXY ScreenWidth - 8,ScreenHeight - 1
  131.    Write VertLine3
  132. EndProc
  133.